home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MACD 5
/
MACD 5.bin
/
workbench
/
blankery
/
blanker
/
source
/
blankers
/
fractal
/
blank.c
next >
Wrap
C/C++ Source or Header
|
1993-08-15
|
2KB
|
63 lines
#include <exec/types.h>
#include <intuition/intuition.h>
#include <dos/dos.h>
#include <clib/exec_protos.h>
#include <clib/intuition_protos.h>
#include <clib/graphics_protos.h>
#include <clib/alib_protos.h>
#include <math.h>
#include "/defs.h"
#include "/utility.h"
extern ULONG Mode, Depth;
VOID FracBlank( struct Screen *Scr, UWORD Wid, UWORD Hei )
{
float x = 0, y = 0, xx, yy, a, b, c;
SHORT i, xe, ye, flg_end = FALSE, mod = ( 1L << Depth ) - 1;
SetRast(&( Scr->RastPort ), 0 );
ScreenToFront( Scr );
a = (float)RangeRand( 1000 ) / 10 - 50.0;
do b = (float)RangeRand( 1000 ) / 10 - 50.0;
while( b == 0.0 );
c = (float)RangeRand( 1000 ) / 10 - 50.0;
for( i = 0; i < 5000 && !flg_end; i++ ) {
if(!( i % 50 )) flg_end = ( SetSignal( 0L, 0L ) & SIGBREAKF_CTRL_C );
if( x < 0 ) xx = y + sqrt( fabs( b * x - c ));
else xx = y - sqrt( fabs( b * x - c ));
yy = a - x;
xe = Wid / 2 + (SHORT)x;
ye = Hei / 2 + (SHORT)y;
SetAPen(&( Scr->RastPort ), ( ReadPixel(&( Scr->RastPort ), xe, ye ) + 1 ) % mod + 1 );
WritePixel(&( Scr->RastPort ), xe, ye );
x = xx;
y = yy;
}
}
VOID blank( VOID )
{
struct Screen *Scr;
if( Scr = OpenScreenTags( NULL, SA_Depth, Depth, SA_Overscan, OSCAN_STANDARD, SA_DisplayID, Mode, SA_Quiet,
TRUE, SA_Behind, TRUE, TAG_DONE )) {
SetRGB4(&( Scr->ViewPort ), 0, 0, 0, 0 );
BlankMousePointer();
while(!(SetSignal(0,0) & SIGBREAKF_CTRL_C )) FracBlank( Scr, Scr->Width, Scr->Height );
SetSignal( 0L, SIGBREAKF_CTRL_C );
UnblankMousePointer();
CloseScreen( Scr );
}
}